package com.apes.fico.masterdata.gl.model;


import com.apes.framework.jpa.ApesBean;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

/**
 * @ClassName AccountingPeriodQuartItem
 * @Description TODO
 * @Author pengyb
 * @Date 2018/12/28 9:57
 * @Version 1.0
 **/

@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = AccountingPeriodQuartItem.CONST_TABLE_NAME, indexes = {
        @Index(columnList = "period_name,acc_period_id", unique = true)
})
public class AccountingPeriodQuartItem implements ApesBean {
    public final static String CONST_TABLE_NAME = "mas_acc_period_quart_item";

    @Id
    @Column(name = "id", length = 8)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "会计季度期间明细")
    @Comment("编号")
    private String id;

    @Column
    @Comment("期间数量")
    private Integer period_num;

    @Column
    @Comment("期间名称")
    private String period_name;


    @Column
    private Integer fromMonth;

    @Column
    private Integer thruMonth;

    @NotNull
    @ManyToOne(optional = false)
    @JoinColumn(name = "acc_period_id", referencedColumnName = "id")
    @Comment("会计期间档案主键")
    private AccountingPeriod accountingPeriods;


}
